/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package evidence.model.modeloveTridy;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

/**
 *
 * @author Protheo
 */
public final class TypSluzby {
    /*
    public static final int OA = 0;
    public static final int PS = 1;
    public static final int OST = 2;
    public static final int FS = 3;
    public static final int POR = 4;
    public static final int STA = 5;
    public static final int SKO = 6;
     *
     */
    public static final int OA = 0;
    public static final int PS = 1;
    public static final int OST = 8;
    public static final int FS = 3;
    public static final int POR = 5;
    public static final int STA = 7;
    public static final int SKO = 6;
    public static final int SP = 4;
    public static final int OS = 2;
    private static final String[] sluzby = {"OA", "PS", "OS", "FS", "SP", "POR", "SKO", "STA", "OST"};

    private TypSluzby(){
    }

    public static Integer pocetSluzeb(){
        return sluzby.length;
    }

    public static String getSluzba(int poradi){
        return sluzby[poradi];
    }

    public static List<String> getSluzby(){
        List<String> pom = getSl();
        return Collections.unmodifiableList(pom);
    }

    public static List<String> getSluzby(Set<Integer> vybrane){
        List<String> pom = getSl();
        List<String> ret = new ArrayList<String>();
        for (Iterator<Integer> it = vybrane.iterator(); it.hasNext();) {
            int integer = it.next();
            ret.add(pom.get(integer));
        }
        for (int j = 0; j < pom.size(); j++) {
            String string = pom.get(j);
            if (!vybrane.contains(new Integer(j))){
                ret.add(string);
            }
        }
        return Collections.unmodifiableList(ret);
    }

    private static List<String> getSl(){
        List<String> pom = new ArrayList<String>(sluzby.length);
        for (int i = 0; i < sluzby.length; i++) {
            String string = sluzby[i];
            pom.add(string);
        }
        return pom;
    }

    public static int getISluzba(String sluzba){
        for (int i = 0; i < sluzby.length; i++) {
            if(sluzba.equals(sluzby[i])){
                return i;
            }
        }
        return -1;
    }
}
